package co.com.ces4.client.baseView;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.SectionStackSection;

/**
 *
 * @author win
 */
public class QueryBase extends CreateBase {

    protected final SectionStackSection titleSection;
    protected final SectionStackSection filterSection;
    protected final SectionStackSection resultsSection;

    public QueryBase(String titleSectionContainer, String filterSectionTitle, String resultsSectionTitle, String width) {
        super(width);
        this.titleSection = new SectionStackSection(titleSectionContainer);
        this.filterSection = new SectionStackSection(filterSectionTitle);
        this.resultsSection = new SectionStackSection(resultsSectionTitle);
        this.titleSection.setExpanded(false);
        this.titleSection.setCanCollapse(false);
        this.filterSection.setExpanded(true);
        this.filterSection.setCanCollapse(true);
        this.resultsSection.setExpanded(true);
        this.resultsSection.setCanCollapse(false);
        setSections(titleSection, filterSection, sectionContainer, resultsSection);
    }

    public void addFilterSectionItem(Canvas item) {
        this.filterSection.addItem(item);
    }

    public void setFilterSectionItems(Canvas... items) {
        this.filterSection.setItems(items);
    }

    public void hideFilterSection() {
        this.filterSection.setHidden(true);
    }

    public void showFilterSection() {
        this.filterSection.setHidden(false);
    }

    public void addResultsSectionItem(Canvas item) {
        this.resultsSection.addItem(item);
    }

    public void hideResultsSection() {
        this.resultsSection.setHidden(true);
    }

    public void showResultsSection() {
        this.resultsSection.setHidden(false);
    }
}
